Skip to content

Viewport resolution scale parameter 2#759

Merged
mcottontensor merged 6 commits intoEpicGamesExt:masterfrom
christianstamati:viewport-resolution-scale-parameter
Apr 23, 2026
Merged

Viewport resolution scale parameter 2#759
mcottontensor merged 6 commits intoEpicGamesExt:masterfrom
christianstamati:viewport-resolution-scale-parameter

Conversation

@christianstamati
Copy link
Copy Markdown
Contributor

Relevant components:

  • Signalling server
  • Common library
  • Frontend library
  • Frontend UI library
  • Matchmaker
  • Platform scripts
  • SFU

Problem statement:

When connecting from an iPhone or small screen device with MatchViewportRes set to true, the rendered resolution appears quite low, causing the visuals to look slightly pixelated.

More info here: #721

Solution

Added a new numeric parameter ViewportResolutionScale that multiplies the resolution dimensions sent to the onMatchViewportResolutionCallback when MatchViewportResolution is enabled. The scale factor is applied to both width and height in VideoPlayer.updateVideoStreamSize(), allowing users to request higher resolution streams (e.g., 1.5x or 2.0x) to improve visual quality on small screens.

Documentation

The new ViewportResolutionScale parameter is documented in Frontend/Docs/Settings Panel.md under the UI section.

Test Plan and Compatibility

Existing unit tests: Config.test.ts automatically covers the new parameter via the "should populate initial values for all settings" test (line 42-49), which validates all numeric parameters are registered

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jan 13, 2026

🦋 Changeset detected

Latest commit: 1d0d804

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@epicgames-ps/lib-pixelstreamingfrontend-ui-ue5.7 Minor
@epicgames-ps/lib-pixelstreamingfrontend-ue5.7 Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

@lukehb lukehb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

We ran this through some QA and I have left a few comments about what we would like changed before we can merge this.

In addition to those suggestions below we would also like:

  1. The new setting to be exposed to the UI by modifying something like this (untested, please verify):
if (isSectionEnabled(settingsConfig, SettingsSections.UI)) {
    /* Setup all view/ui related settings under this section */
    const viewSettingsSection = this.buildSectionWithHeading(settingsElem, SettingsSections.UI);
    if (isSettingEnabled(settingsConfig, Flags.MatchViewportResolution))
        this.addSettingFlag(viewSettingsSection, this.flagsUi.get(Flags.MatchViewportResolution));

    // Your new setting here
    if (isSettingEnabled(settingsConfig, NumericParameters.ViewportResolutionScale))
        this.addSettingNumeric(viewSettingsSection, NumericParameters.ViewportResolutionScale);
        
    // ... Other view settings
}
  1. A changeset added with accompanying long form change log entry, see: #759 (comment) for how to make a changset - When you make the changeset, it will be a minor change bump to both the library and UI library packages.

Comment thread Frontend/library/src/Config/Config.ts Outdated
'Viewport Resolution Scale',
'Scale factor for viewport resolution when MatchViewportResolution is enabled. 1.0 = 100%, 0.5 = 50%, 2.0 = 200%.',
0.1 /*min*/,
10.0 /*max*/,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did some QA on this and we think 3x is a sane maximum. Values above that will commonly cause the encoder to fail as this will exceed the maximum encoding size on our H.264 settings - e.g. 4096x4096.

Suggested change
10.0 /*max*/,
3.0 /*max*/,

Comment thread Frontend/Docs/Settings Panel.md Outdated
@@ -31,6 +31,7 @@ This page will be updated with new features and commands as they become availabl
| **Setting** | **Description** |
| --- | --- |
| **Match viewport resolution** | Resizes the Unreal Engine application resolution to match the browser's video element size.|
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| **Match viewport resolution** | Resizes the Unreal Engine application resolution to match the browser's video element size.|
| **Match Viewport Resolution** | Resizes the Unreal Engine application resolution to match the browser's video element size. (Note: We recommend using `-windowed` on the UE side to allow scaling beyond monitor size.)|

Comment thread Frontend/Docs/Settings Panel.md Outdated
| **Setting** | **Description** |
| --- | --- |
| **Match viewport resolution** | Resizes the Unreal Engine application resolution to match the browser's video element size.|
| **Viewport Resolution Scale** | Scale factor for viewport resolution when Match Viewport Resolution is enabled. Range: 0.1-10.0, Default: 1.0. Values above 1.0 (e.g., 1.5, 2.0) can improve visual quality on small screens by requesting higher resolution streams. |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| **Viewport Resolution Scale** | Scale factor for viewport resolution when Match Viewport Resolution is enabled. Range: 0.1-10.0, Default: 1.0. Values above 1.0 (e.g., 1.5, 2.0) can improve visual quality on small screens by requesting higher resolution streams. |
| **Viewport Resolution Scale** | Scale factor for viewport resolution when Match Viewport Resolution is enabled. Range: 0.1-3.0, Default: 1.0 (no scaling). Values above 1.0 (e.g., 1.5, 2.0) can improve visual quality on small screens by requesting higher resolution streams. |

@christianstamati
Copy link
Copy Markdown
Contributor Author

Hi @lukehb,
I've addressed all the changes here. The ViewportResolutionScale setting is now configured and positioned under MatchViewportResolution as requested.
However, after adding the code at ConfigUI.ts (206-210), building everything, and launching the SignalingServer, I don't see the option in the player UI. Could you help troubleshoot why it's not appearing?
Thanks!

@Belchy06
Copy link
Copy Markdown
Collaborator

Belchy06 commented Feb 9, 2026

Hey @christianstamati,

You might have a bad local state.

I was able to build this branch and run the signalling server by running ./SignallingWebServer/platform_scripts/cmd/start.bat --build and after a page refresh I can see the UI element displaying.

…e constant

- Round scaled dimensions to integers before sending Resolution.Width /
  Height commands to UE (non-integers were being JSON-stringified and
  handed to cvar parsing).
- Warn via Logger when a scaled dimension exceeds the H.264 4096 limit so
  large viewports with high scales surface a clear encoding-failure hint.
- Rename NumericParameters.ViewportResolutionScale -> ViewportResScale so
  the TS constant matches the URL-param / persisted key ('ViewportResScale').
- Add Config.hasNumericSetting and fall back to 1.0 in VideoPlayer when
  the setting is absent, so custom Config subclasses do not throw on
  every resize.
- Add VideoPlayer Jest coverage for default, scaled, rounded, >4096-warn,
  within-limit, missing-setting-fallback, and flag-disabled paths.
@mcottontensor mcottontensor added auto-backport Used to specify we want a PR to auto backport to a branch, must be paired with auto-backport-to-UEX. auto-backport-to-UE5.5 auto-backport-to-UE5.6 auto-backport-to-UE5.7 labels Apr 23, 2026
@mcottontensor mcottontensor merged commit 60da95c into EpicGamesExt:master Apr 23, 2026
8 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

💔 Some backports could not be created

Status Branch Result
UE5.5 Backport failed because of merge conflicts
UE5.6 Backport failed because of merge conflicts
UE5.7

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

backport --pr 759

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

@mcottontensor
Copy link
Copy Markdown
Collaborator

💚 All backports created successfully

Status Branch Result
UE5.6

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@mcottontensor
Copy link
Copy Markdown
Collaborator

💚 All backports created successfully

Status Branch Result
UE5.5

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

mcottontensor added a commit that referenced this pull request Apr 23, 2026
* Viewport resolution scale parameter 2 (#759)

* Add ViewportResolutionScale configuration parameter

* Add Docs for Viewport Resolution Scale in Frontend/Docs/Settings Panel.md

* Address PR feedback: improve ViewportResolutionScale configuration

* Harden ViewportResScale: round output, warn past encoder limit, rename constant

- Round scaled dimensions to integers before sending Resolution.Width /
  Height commands to UE (non-integers were being JSON-stringified and
  handed to cvar parsing).
- Warn via Logger when a scaled dimension exceeds the H.264 4096 limit so
  large viewports with high scales surface a clear encoding-failure hint.
- Rename NumericParameters.ViewportResolutionScale -> ViewportResScale so
  the TS constant matches the URL-param / persisted key ('ViewportResScale').
- Add Config.hasNumericSetting and fall back to 1.0 in VideoPlayer when
  the setting is absent, so custom Config subclasses do not throw on
  every resize.
- Add VideoPlayer Jest coverage for default, scaled, rounded, >4096-warn,
  within-limit, missing-setting-fallback, and flag-disabled paths.

---------

Co-authored-by: Matthew.Cotton <matt@tensorworks.com.au>
(cherry picked from commit 60da95c)

# Conflicts:
#	Frontend/library/src/VideoPlayer/VideoPlayer.ts

* fix: fixing ue version reference.

---------

Co-authored-by: Christian Stamati <hello@chri.dev>
mcottontensor added a commit that referenced this pull request Apr 23, 2026
* Viewport resolution scale parameter 2 (#759)

* Add ViewportResolutionScale configuration parameter

* Add Docs for Viewport Resolution Scale in Frontend/Docs/Settings Panel.md

* Address PR feedback: improve ViewportResolutionScale configuration

* Harden ViewportResScale: round output, warn past encoder limit, rename constant

- Round scaled dimensions to integers before sending Resolution.Width /
  Height commands to UE (non-integers were being JSON-stringified and
  handed to cvar parsing).
- Warn via Logger when a scaled dimension exceeds the H.264 4096 limit so
  large viewports with high scales surface a clear encoding-failure hint.
- Rename NumericParameters.ViewportResolutionScale -> ViewportResScale so
  the TS constant matches the URL-param / persisted key ('ViewportResScale').
- Add Config.hasNumericSetting and fall back to 1.0 in VideoPlayer when
  the setting is absent, so custom Config subclasses do not throw on
  every resize.
- Add VideoPlayer Jest coverage for default, scaled, rounded, >4096-warn,
  within-limit, missing-setting-fallback, and flag-disabled paths.

---------

Co-authored-by: Matthew.Cotton <matt@tensorworks.com.au>
(cherry picked from commit 60da95c)

# Conflicts:
#	Frontend/library/src/VideoPlayer/VideoPlayer.ts

* fix: fixing ue version references.

---------

Co-authored-by: Christian Stamati <hello@chri.dev>
mcottontensor added a commit that referenced this pull request Apr 23, 2026
* Add ViewportResolutionScale configuration parameter

* Add Docs for Viewport Resolution Scale in Frontend/Docs/Settings Panel.md

* Address PR feedback: improve ViewportResolutionScale configuration

* Harden ViewportResScale: round output, warn past encoder limit, rename constant

- Round scaled dimensions to integers before sending Resolution.Width /
  Height commands to UE (non-integers were being JSON-stringified and
  handed to cvar parsing).
- Warn via Logger when a scaled dimension exceeds the H.264 4096 limit so
  large viewports with high scales surface a clear encoding-failure hint.
- Rename NumericParameters.ViewportResolutionScale -> ViewportResScale so
  the TS constant matches the URL-param / persisted key ('ViewportResScale').
- Add Config.hasNumericSetting and fall back to 1.0 in VideoPlayer when
  the setting is absent, so custom Config subclasses do not throw on
  every resize.
- Add VideoPlayer Jest coverage for default, scaled, rounded, >4096-warn,
  within-limit, missing-setting-fallback, and flag-disabled paths.

---------


(cherry picked from commit 60da95c)

Co-authored-by: Christian Stamati <hello@chri.dev>
Co-authored-by: Matthew.Cotton <matt@tensorworks.com.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Used to specify we want a PR to auto backport to a branch, must be paired with auto-backport-to-UEX. auto-backport-to-UE5.5 auto-backport-to-UE5.6 auto-backport-to-UE5.7 never-stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants